package com.sec.etech.ism.util;

public class IsmStringUtil extends org.openbpm.base.core.util.StringUtil {

    /**
     * 把null处理为空字符串
     * @param str
     * @return
     */
    public static String getStrNullToEmpty(String str){
        return str==null ? "" : str.trim();
    }

    /**
     * 把null处理为空字符串
     * @param object
     * @return
     */
    public static String getStrNullToEmpty(Object object){
        return object==null ? "" : object.toString().trim();
    }
    /**
     * 统计字符串中另一字符串出现的数量
     * @param str
     * @param s
     */
    public static int countString(String str, String s) {
        String str1 = str.replaceAll(s, "");
        int len1 = str.length(),len2 = str1.length(),len3 = s.length();
        int count = (len1 - len2) / len3;
        return count;
    }
}
